<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
	<head>
		<title>郑州十目科技-OA系统</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<!-----jquery---->
		<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.2.js"></script>
		<!----jquery插件之cookie---->
		<script type="text/javascript" src="__PUBLIC__/js/jquery.cookie.js"></script>
		<!-----bootstrap---->
		<script type="text/javascript" src="__PUBLIC__/js/bootstrap/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/js/bootstrap/css/bootstrap.min.css"/>
		<link rel="stylesheet" href="__PUBLIC__/js/bootstrap/css/bootstrap-theme.css"/>
		<!-----简易的datepicker------->
		<script src="__PUBLIC__/js/datepicker/easydatepicker.js"></script>
		<link href="__PUBLIC__/js/datepicker/easydatepicker.css" type="text/css" rel="stylesheet">
		<!------messager--------->
		<script type="text/javascript" src="__PUBLIC__/js/messager/messenger.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/js/messager/messenger.css"/>
		<link rel="stylesheet" href="__PUBLIC__/js/messager/messenger-theme-future.css"/>
		<!----fancybox------->
		<script type="text/javascript" src="__PUBLIC__/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
		<!-----write by liminglei---->
		<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/css/layout.css"/>
	</head>
	<body>
		<div class="main">
			<div class="header">
				<img src="__PUBLIC__/img/cm.png" style="width:200px;"/>		
				<div class="menu pull-right">
					<ul>
						<li class="pull-right tooltips" data-placement="right" data-toggle="tooltip" data-original-title="回到首页"><i class="glyphicon glyphicon-home home"></i></li>
						<li class="pull-right tooltips" data-placement="bottom" data-toggle="tooltip" data-original-title="退出"><i class="glyphicon glyphicon-off exit"></i></li>
						<li class="pull-right tooltips" data-placement="bottom" data-toggle="tooltip" data-original-title="个人资料"><i class="glyphicon glyphicon-user personal"></i></li>
						<li class="pull-right tooltips" data-placement="bottom" data-toggle="tooltip" data-original-title="查看日志"><i class="glyphicon glyphicon-eye-open view"></i></li>
						<li class="pull-right tooltips" data-placement="left" data-toggle="tooltip" data-original-title="编写日志"><i class="glyphicon glyphicon-plus open-publish"></i></li>
					</ul>
				</div>
				<ul class="dropdown-menu show pull-right affix col-md-3 right-nav" role="menu" style="top:160%;position:absolute;" aria-labelledby="dropdownMenu2">
  <?php if(session('uid') == 1): ?><li><a href="javascript:MP('__APP__/Account/userManage','user-manage')"><i class="right-forward"></i>员工管理</a></li>
  <li class="divider"></li>
  <li><a href="javascript:MP('__APP__/Department/departmentList','department-list')"><i class="right-forward"></i>部门管理</a></li>
  <li class="divider"></li>
  <li><a href="javascript:MP('__APP__/Department/departmentLogs','department-log')"><i class="right-forward"></i>部门日志</a></li>
  <li class="divider"></li>
  <?php else: endif; ?>
  <li><a href="javascript:MP('__APP__/Customer/customerList','customer-list')"><i class="right-forward"></i>客户跟进笔记</a></li>
  <li class="divider"></li>
  <li><a href="javascript:MP('__APP__/Topic/index','common-list')"><i class="right-forward"></i>公共版块</a></li>
</ul>
			</div>
		</div>
		<div class="log-list" id="log-list">
			<div class="content"></div>
		</div>
		<!-- /发布日志 -->
		<link rel="stylesheet" href="__PUBLIC__/js/extends/kindeditor/themes/default/default.css" />
		<script charset="utf-8" src="__PUBLIC__/js/extends/kindeditor/kindeditor.js"></script>
		<script charset="utf-8" src="__PUBLIC__/js/extends/kindeditor/lang/zh_CN.js"></script>
		
		<div class="modal fade" id="work" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title" id="myModalLabel">发布日志</h4>
			  </div>
			  <div class="modal-body">
				<form>
					<h5>标题<span class="remind">(可不填)</span></h5>
					<input type="text" class="form-control" name="title"/>
					<h5>内容<span class="remind">(必填)</span></h5>
					<textarea rows="14" class="editor_id pubwork" class="form-control" name="work" style="width:100%;"></textarea>
				</form>
			  </div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary publish">发布</button>
			  </div>
			</div>
		  </div>
		</div>
		<!-- 发布日志/ -->
		<!------/日志列表 模态显示------->
		<div class="modal fade" id="work-log" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title work-log-title" id="myModalLabel"></h4>
			  </div>
			  <div class="modal-body work-log-content" style="word-break: break-all;"></div>

			<div class="comment-lists"></div>

			  <textarea class="editor_id comment" class="form-control" style="width:95%;height:150px"></textarea>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary leaveword" id="">留言</button>
			  </div>
			</div>
		  </div>
		</div>
		<!------日志列表 模态显示/------->
		<!------/话题内容 模态显示------->
		<div class="modal fade" id="topic-content" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title topic-title" id="myModalLabel"></h4>
			  </div>
			  <div class="modal-body topic-body" style="word-break: break-all;"></div>

			<div class="comment-lists"></div>

			  <textarea class="topic-editor" class="form-control" style="width:95%;height:150px"></textarea>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary topic-leaveword" id="">留言</button>
			  </div>
			</div>
		  </div>
		</div>
		<!------话题内容 模态显示/------->
		<!------/意见反馈 模态显示------->
		<div class="modal fade" id="dialogfeedback" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title" id="myModalLabel">意见反馈</h4>
			  </div>
			  <div class="modal-body">
				<form>
					<h5>反馈简述<span class="remind">(可不填)</span></h5>
					<input type="text" class="form-control" name="feedback"/>
					<h5>反馈内容<span class="remind">(必填)</span></h5>
					<textarea rows="14" class="feedwork-editor" class="form-control" name="work" style="width:100%;"></textarea>
				</form>
			  </div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary feedback">反馈</button>
			  </div>
			</div>
		  </div>
		</div>
		<!------意见反馈 模态显示/------->
		<!-----/跟踪笔记 模态显示------>
		<div class="modal fade" id="customer-track" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title customer-track-title" id="myModalLabel"></h4>
			  </div>
			  <div class="modal-body customer-track-remark" style="word-break: break-all;">
				<div class="panel-group" id="accordiontrack">
						<div class="panel panel-default">
							<div class="panel-heading">
							  <h4 class="panel-title">
								<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordiontrack" href="#collapsetrack" style="display:block;width:100%;text-decoration:none">点击查看客户基本资料</a>
							  </h4>
							</div>
							<div id="collapsetrack" class="panel-collapse collapse">
							  <div class="panel-body"></div>
							</div>
						</div>
				</div>
			  </div>
				<h4 style="padding:0 15px;text-align:center"><span class="label label-primary">历史跟踪记录</span></h4>
				<div class="track-lists"></div>
				<h4 style="padding:0 15px;"><span class="label label-primary">添加跟踪记录</span></h4>
				

			  <textarea class="track" class="form-control" style="width:95%;height:150px"></textarea>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary leavetrack" id="">确定</button>
			  </div>
			</div>
		  </div>
		</div>
		<!-----跟踪笔记 模态显示/------>
		<!------/个人资料 模态显示------->
		<div class="modal fade" id="personal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title" id="myModalLabel">个人资料</h4>
			  </div>
			  <form id="personal-form" onsubmit="return false;">
			  <div class="modal-body">
					<table class="table table-bordered" style="margin-bottom:0px">
						<tr>
							<td>姓名</td><td><input type="text" class="form-control" name="name"/></td>
							<td>男</td><td><input type="radio" style="margin: auto;" name="gender" value="男" id="man" class="form-control"/></td>
							<td>女</td><td><input type="radio" name="gender" style="margin: auto;" value="女" id="woman" class="form-control"/></td>
						</tr>
						<tr><td>部门</td><td colspan="5"><input type="text" class="form-control" name="department-name" disabled/></td></tr>
						<tr><td>手机</td><td colspan="5"><input type="text" class="form-control" name="mobile"/></td></tr>
						<tr><td>邮箱</td><td colspan="5"><input type="text" class="form-control" name="email"/></td></tr>
						<tr><td>备注</td><td colspan="5"><textarea name="remark" class="form-control"></textarea></td></tr>
					</table>
			  </div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="submit" class="btn btn-primary change-psersonal">更改</button>
			  </div>
			  </form>
			</div>
		  </div>
		</div>
		<!------个人资料 模态显示/------->
		<!------/系统提示 模态显示------->
		<div class="modal fade" id="system" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title" id="myModalLabel">系统提示</h4>
			  </div>
			  <div class="modal-body"></div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary sure">确定</button>
			  </div>
			</div>
		  </div>
		</div>
		<!------系统提示 模态显示/------->	
		<!------/公共操作 模态显示------->
		<div class="modal fade" id="operate" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title operate-title" id="myModalLabel"></h4>
			  </div>
			  <div class="modal-body operate-body"></div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default operate-close" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary operate-sure">确定</button>
			  </div>
			</div>
		  </div>
		</div>
		<!------公共操作 模态显示/------->
		<!-- 发布话题/ -->
		<div class="modal fade" id="topic" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
			<div class="modal-content">
			  <div class="modal-header">
				<button type="button" class="close tooltips" data-dismiss="modal" aria-hidden="true" data-placement="left" data-toggle="tooltip" data-original-title="关闭">&times;</button>
				<h4 class="modal-title" id="myModalLabel">发布话题</h4>
			  </div>
			  <div class="modal-body">
				<form id="topic-post-form">
					<h5>标题<span class="remind">(必填)</span></h5>
					<input type="text" class="form-control" name="topic_title"/>
					<h5>内容<span class="remind">(必填)</span>
						<span class="pull-right">话题分类<span class="remind">(必填)</span>
							<select name="category_id">
								<option value="0">--请选择--</option>
								<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["category_id"]); ?>"><?php echo ($vo["category_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
							</select>
						</span>
					</h5>
					<textarea rows="14" class="topic" class="form-control" name="topic_content" style="width:100%;"></textarea>
				</form>
			  </div>
			  <div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary publish_topic">发布</button>
			  </div>
			</div>
		  </div>
		</div>
		<!-- 发布话题/ -->
		<script>
$(function(){
	$(".publish").bind("click",function(){
		html = editor.html();

			// 同步数据后可以直接取得textarea的value
			editor.sync();
			//html = document.getElementById('editor_id').value; // 原生API
			///html = K('#editor_id').val(); // KindEditor Node API
			html = $('.pubwork').val(); // jQuery
			if(html == ""){
				$.globalMessenger().post("日志内容不能为空");
				return;
			}
		$.post("__APP__/Work/worklogPublish",{title:getInputValueByName('title'),work:html},function(json){
			//alert($(this).parents(".modal").length);
			$("#work").modal("hide");
			$.globalMessenger().post(json.info);
			if($(".panel").length == 0){
				MP('__APP__/Work/workLog','work-log');
			}else{
				var per_worklog = "<div class='panel panel-default' style='margin-top:10px;display:none'><div class='panel-heading'><h4 class='panel-title'>"+getInputValueByName('title')+"<span class='pull-right'>"+json.data.pulisher+"&nbsp;&nbsp;&nbsp;"+json.data.create_time+"</span></h4></div><div id='collapseOne' class='panel-collapse collapse in'><div class='panel-body' style='word-break: break-all;'>"+html+"</div><div class='work-log-content<?php echo ($vo["worklog_id"]); ?> hide'>"+html+"</div></div></div>";
				$("#accordion").prepend(per_worklog).children(":first").slideDown(500);
			}
			$("input[name='title']").val("");
			html = editor.html("");
		});
	});
	$(".view").bind("click",function(){
		MP('__APP__/Work/workLog','work-log','true');
	});
	$(".home").bind("click",function(){
		$(".content").empty();
	});
	$(".leaveword").bind("click",function(){
		html = editor1.html();
		$.post("__APP__/Comment/reply",{worklog_id:$(this).attr("id"),comment:html},function(json){
			html = editor1.html("");
			if(json.status == 1){
				var insertComment = "<div class='panel panel-default comment-list' style='display:none'><div class='panel-heading'><h4 class='panel-title'><a class='accordion-toggle' data-parent='#accordion'>"+json.data.replier+"&nbsp;&nbsp;&nbsp;"+json.data.create_time+"</a></h4></div><div id='collapseOne' class='panel-collapse collapse in'><div class='panel-body' style='word-break: break-all;'>"+json.data.comment+"</div></div></div>";
				$(".comment-lists").append(insertComment).children(":last").slideDown(500);
			}
			$.globalMessenger().post(json.info);
		});
	});
	$(".tooltips").tooltip();
	$("#feedback").bind("click",function(){
		$("#dialogfeedback").modal("show");
	});
	$(".open-publish").bind("click",function(){
		$("#work").modal("show");
	});
	$(".feedback").bind("click",function(){
		html = editor2.html();
		$.post('__APP__/Public/feedback',{title:$("input[name='feedback']").val(),content:html},function(json){
			if(json.status == 1){	
				html = editor1.html("");
				$("#dialogfeedback").modal("hide");
			}
			$.globalMessenger().post(json.info);
		});
	});
	$(".exit").click(function(){
		$("#system .modal-body").html("是否确认退出系统？");
		$("#system .sure").unbind('click').bind('click',function(){
			logout();
			$("#system").modal("hide");
		});
		$("#system").modal("show");
	});
	$(".personal").click(function(){
		$.post('__APP__/Account/userProfile',function(json){	
			if(json.status == 1){
				pushInputValueByName("name",json.data.name);
				if(json.data.gender == "男"){
					$("#man").attr("checked",true);
				}else{
					$("#womenman").attr("checked",true);
				}
				pushInputValueByName("department-name",json.data.department_name);
				pushInputValueByName("mobile",json.data.mobile);
				pushInputValueByName("email",json.data.email);
				$("textarea[name='remark']").val(json.data.remark);
			}
			$("#personal").modal('show');
		});
	});
	$(".department-manage").die().live('click',function(){
		renameSure("确定");
		var department_id = $(this).attr('department-id');
		$(".operate-title").html("部门管理>>"+$(this).attr("department-name"));
		$(".operate-body").load("__APP__/Department/departmentManage",{department_id:department_id},function(){
		});
		$("#operate").modal('show');
	});
	$(".peruser-manage").die().live('click',function(){
		renameSure("确定");
		var titlename = $(this).attr("user-name");
		var uid = $(this).attr("user-uid");
		if(titlename == ""){
			titlename = "账号:"+$(this).attr("user-account");
		}
		$(".operate-title").html("员工管理>>"+titlename);
		$(".operate-body").load('__APP__/Account/userMsgInfo',{uid:uid},function(){
			$(".operate-sure").unbind('click').click(function(){
				if($("#user-msg-info-form input[name='name']").val() == ""){
					$.globalMessenger().post("姓名不能为空");
					return;
				}
				$.post('__APP__/Account/userProfile/uid/'+uid,$("#user-msg-info-form").serialize(),function(json){
					$.globalMessenger().post(json.info);
				})
			});
		});
		$("#operate").modal('show');
	});
	$(".worker-transfer").die().live('click',function(){
		$(".move-department").remove();
		var user_name = $(this).attr("user-name"),
			user_id = $(this).attr("user-uid"),
			option = "";
		var moveDepartment = "<tr class='move-department'><td colspan='4'><h4 style='text-align:center'>员工<span class='label label-info'>"+user_name+"</span>将被调动到部门<select id='move_id' name='department_id'></select>&nbsp;<input class='btn btn-default close-tranfer' type='button' value='关闭'>&nbsp;<input class='btn btn-primary tranfer-operate' id='"+user_id+"' type='button' value='确定'></h4></td></tr>";
		$.post('__APP__/Department/getDepartment',function(json){
			for(var i = 0;i < json.data.length;i++){
				option  += "<option value='"+json.data[i].department_id+"'>"+json.data[i].department_name+"</option>";
			}
			$("#move_id").append(option);
		});
		$(this).parents("tr").after(moveDepartment);
	});
	$(".tranfer-operate").die().live('click',function(){
		$.post('__APP__/Department/departmentTranfer',{department_id:$("#move_id").val(),user_uid:$(this).attr("id")},function(json){
			$.globalMessenger().post(json.info);
			if(json.status == 1){
				$(".move-department").prev().remove();
				$(".move-department").remove();
			}
		});
	});
	$(".close-tranfer").die().live('click',function(){
		$(this).parents(".move-department").remove();
	});
	$("#select_viewlog_method").die().live('change',function(){
		$("#datepicker").val("");
		$("#search-by-datepicker").attr("view-method",$(this).val());
		searchDepartmentLog($('#select_departmentlog_id').val(),$(this).val(),'__APP__/Department/departmentLogs');
	});
	$("#select_departmentlog_id").die().live('change',function(){
		$("#datepicker").val("");
		$("#search-by-datepicker").attr("department-id",$(this).val());
		searchDepartmentLog($(this).val(),$('#select_viewlog_method').val(),'__APP__/Department/departmentLogs');
	});
	$("#search-by-datepicker").die().live('click',function(){
		if(getInputValueById("datepicker") == ""){
			$.globalMessenger().post("日期为空");
			return;
		}
		var date = getInputValueById("datepicker");
		$(".worker-worklog-list").load("__APP__/Department/departmentLogs .worker-worklog-contents",{department:$(this).attr("department-id"),viewmethod:$(this).attr("view-method"),date:date});
	});
	$(".add-worker").die().live('click',function(){
		addWorker('__APP__/Account/addWorker','#add-account-form','__APP__/Public/reg','__APP__/Account/userProfile');
	});
	$(".worker-leave").die().live('click',function(){
		$("#system .modal-body").html("<h4 style='text-align:center'>确定辞退员工<span class='label label-danger'>"+$(this).attr("user-name")+"</span>吗？</h4>");
		var uid = $(this).attr("user-uid");
		$(this).addClass("selected");
		$("#system .sure").click(function(){
			workerResign('__APP__/Account/workerResign',uid);
		});
		$("#system").modal('show');
	});
	$(".add-customer").die().live('click',function(){
		renameTitle("添加客户");
		bodyLoad('__APP__/Customer/addCustomer',function(){
			rebindSure(function(){
				if($("#customer-name").val() == ""){
					$.globalMessenger().post("客户姓名不能为空");
					return;
				}
				$.post('__APP__/Customer/addCustomer/type/addCustomer',$("#add-customer-form").serialize(),function(json){
					$.globalMessenger().post(json.info);
					if(json.status == 1){
						MP('__APP__/Customer/customerList','customer-list');
						renameTitle("填写用户基本信息");
						bodyLoad('__APP__/Customer/addCustomer/type/individual',function(){
							$("input[name='customer_id']").val(json.data);
							rebindSure(function(){
								$.post('__APP__/Customer/addCustomer/type/individual/control/1',$("#add-individual-form").serialize(),function(json){
									$.globalMessenger().post(json.info);
									if(json.status == 1){
										$("#operate").modal('hide');
									}
								});
							});
						})
					}
				})
			});
		});
		$("#operate").modal('show');
	});
});
</script>
		<div class="tool">
			<a rel="nofollow" id="gotop" class="tooltips" data-placement="left" data-toggle="tooltip" type="button" data-original-title="置顶"></a>
			<a rel="nofollow" id="feedback" class="tooltips" data-placement="left" data-toggle="tooltip" type="button" data-original-title="意见反馈"></a>
		</div>
		<script>
			$(function(){
				$(".right-nav li").click(function(){
					$(".right-nav li").each(function(){
						$(this).removeClass("active");
					});
					$(this).toggleClass("active");
				});
			});
			//提交表单
			$.getScript("__PUBLIC__/js/jquery.form.js",function(){
				$("#personal-form").submit(function(){
					$(this).ajaxSubmit({
						url:'__APP__/Account/userProfile',
						dataType:'json',
						success:function(json){
							$.globalMessenger().post(json.info);
							if(json.status == 1){
								$("#personal").modal('hide');
							}
						}
					});
				});
			});
			var gotop=document.getElementById('gotop'),timer=null,divlist=document.getElementById('log-list');
			divlist.onscroll=function(){gotop.style.display=getX()>100?'block':'none'; };
			gotop.onclick=function(){
				timer=setInterval(goTo,10);
				function goTo(){
					var x=getX()/1.1;
					divlist.scrollTop?divlist.scrollTop=x:document.body.scrollTop=x;
					x<1&&clearInterval(timer);
				}
				return false;
			}
			function getX() {return divlist.scrollTop || document.body.scrollTop }
			$(function(){
				var options = {
					items:[
							'undo', 'redo', '|', 'preview',  'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
							'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'quickformat', 'selectall', '|', 'fullscreen', 
							'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
							'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
							'hr', 'pagebreak','emoticons',
					]
				};
				KindEditor.ready(function(K) {
					//window.editor = K.create('#editor_id',options);
					window.editor = K.create('.pubwork',options);
					window.editor1 = K.create('.comment',options);
					window.editor2 = K.create('.feedwork-editor',options);
					window.editor3 = K.create('.track',options);
					window.editor4 = K.create('.topic',options);
					window.editor5 = K.create('.topic-editor',options);
				});
			})
			function logout(){
				$.getJSON("__APP__/Public/logout",function(json){
					if(json.status == 1){
							//退出成功关闭浏览器
							window.opener=null;
							window.open('','_self');
							window.close();
							window.location="__ROOT__/index.php";
					}else{
					
					}
				});
			}
		</script>
	</body>
</html>